package gof.com.yew.singleton;

//双重检测锁式
public class SingletonDemo03 {
	
	private volatile static SingletonDemo03 instance = null;
	
	//构造器私有
	private SingletonDemo03() {}
	
	public static SingletonDemo03 getInstance() {
		if(instance == null) {
			synchronized (SingletonDemo03.class) {
				if(instance == null) {
					instance = new SingletonDemo03();
				}
			}
		}
		return instance;
	}
	
}
